package com.hp.provider.service.impl;


import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.google.common.collect.Lists;
import com.hp.provider.dao.UserMapper;
import com.hp.provider.po.User;
import com.hp.provider.service.UserService;
import org.apache.ibatis.reflection.ExceptionUtil;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author dongxing
 * @since 2019-05-19
 */
@Service
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {

    @Override
    @SentinelResource(value = "test", blockHandler = "handleException", blockHandlerClass = {ExceptionUtil.class})
    public List<User> findList() {
        List<User> lists = Lists.newArrayList();
        for (int i = 0; i < 10; i++) {
            lists.add(User.builder().id(i).userName("王五" + i).build());
        }
        return lists;
    }
}
